package com.ylyl.langchain4j04lowhighapi.config;


import com.ylyl.langchain4j04lowhighapi.service.ChatAssistant;
import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.service.AiServices;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class LLMConfig {

 @Bean(name = "Qwen")

    public ChatModel chatModelQwen(){
        return OpenAiChatModel.builder()
                    .apiKey(System.getenv("aliQwen-api"))
                    .modelName("qwen-plus")
                    .baseUrl("https://dashscope.aliyuncs.com/compatible-mode/v1")
                .build();
    }

   @Bean(name = "DeepSeek")
    public ChatModel chatModelDeepSeek(){
        return OpenAiChatModel.builder()
                .apiKey(System.getenv("deepseek-api"))
                .modelName("deepseek-chat")
                .baseUrl("https://api.deepseek.com")
                .build();
    }

    @Bean
    public ChatAssistant chatAssistant(@Qualifier("Qwen") ChatModel chatModelQwen){
     return AiServices.create(ChatAssistant.class,chatModelQwen);
    }
}
